<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>top</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
      <%--<script type="text/javascript"--%>
              <%--src="../js/jquery-3.4.1.min.js">--%>

      <%--</script>--%>
      <script type="text/javascript" src="/adminjsps/js/jquery-3.2.1.min.js"></script>
  </head>
  
  <body style="background: rgb(78,78,78);color: white;">
<h1 style="text-align: center; "> LANOU 网络图书商城后台管理</h1>
<p style="font-size: 11pt;" class="p">管理员：<span class="span"></span>
<%--<a id="out">退出</a>--%>
</p>
<script type="text/javascript">
    function getUrlParameter(name){
        name = name.replace(/[]/,"\[").replace(/[]/,"\[").replace(/[]/,"\\\]");
        var regexS = "[\\?&]"+name+"=([^&#]*)";
        var regex = new RegExp( regexS );
        var results = regex.exec(window.parent.location.href );
        if( results == null ) return ""; else {
            return results[1];
        }
    };
    var username=getUrlParameter('username');
    window.onload=function () {
        $.ajax({
            url:"/session",
            type:"get",
            success:function (re) {
                if (re.code == 1000) {
                    $(".span").html(username);
                }else {
                    // location.href="/Home/Login.html";
                    $("<a href='/Home/Login.html'>登录</a>")
                }

            }
        })
    }
    $("#out").click(function () {
        $.ajax({
            url:"/out",
            type:"get",
            success:function (re) {
                if (re.code == 1000) {
                    location.href="/Home/Login.html"
                }
            }
        })
    })
</script>
  </body>
</html>
